home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume8 / cz / part03 < prev    next >
Encoding:
Text File  |  1989-09-30  |  46.2 KB  |  1,337 lines

  1. Newsgroups: comp.sources.misc
  2. subject: v08i067: cz text to PostScript system, part 03 of 14
  3. from: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  4. Reply-To: howard@dahlbeck.ericsson.se (Howard Gayle)
  5.  
  6. Posting-number: Volume 8, Issue 67
  7. Submitted-by: howard@dahlbeck.ericsson.se (Howard Gayle)
  8. Archive-name: cz/part03
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then feed it
  12. # into a shell via "sh file" or similar.  To overwrite existing files,
  13. # type "sh file -c".
  14. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  15. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  16. # If this archive is complete, you will see the following message at the end:
  17. #        "End of archive 3 (of 14)."
  18. # Contents:  78dkus.c 78triFreq.c MakeCommon T-61.p4 b.bib bytefreq.1
  19. # Wrapped by howard@dahlbeck on Mon Sep 25 07:15:13 1989
  20. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  21. if test -f '78dkus.c' -a "${1}" != "-c" ; then 
  22.   echo shar: Will not clobber existing file \"'78dkus.c'\"
  23. else
  24. echo shar: Extracting \"'78dkus.c'\" \(30798 characters\)
  25. sed "s/^X//" >'78dkus.c' <<'END_OF_FILE'
  26. X/*
  27. X * 78dkus - convert Danish or (US) English from ISO 646 to ISO 8859/1
  28. X */
  29. X
  30. X#ifndef lint
  31. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  32. X#endif lint
  33. X
  34. X/*
  35. X * This program is free software; you can redistribute it and/or modify
  36. X * it under the terms of the GNU General Public License version 1,
  37. X * as published by the Free Software Foundation.
  38. X *
  39. X * This program is distributed in the hope that it will be useful,
  40. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  41. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  42. X * GNU General Public License for more details.
  43. X *
  44. X * You should have received a copy of the GNU General Public License
  45. X * along with this program; if not, write to the Free Software
  46. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  47. X */
  48. X
  49. X#include <stdio.h>
  50. X#include <howard/port.h>
  51. X#include <howard/version.h>
  52. X#include <howard/usage.h>
  53. X
  54. XMAINVER ("@(#)$Header: 78dkus.c,v 1.2 89/08/26 13:26:06 howard Exp $");
  55. XUSAGE ("[-# shar-points] [-A attack] [-B blank-line-smoothing] [-D decay] [-b body-points] [-c colon-smoothing] [-d] [-f] [-m] [-s lines] [-t threshold]");
  56. X
  57. X#include <ctype.h>
  58. X#include <limits.h>
  59. X#include <string.h>
  60. X#include <howard/a2.h>
  61. X#include <howard/malf.h>
  62. X#include <howard/registers.i>
  63. X#include "cz.h"
  64. X#include "78.h"
  65. X
  66. XPRIVATE byteT byte2t[256] = /* Map each byte to a trigram code.*/
  67. X{
  68. X32,
  69. X32,
  70. X32,
  71. X32,
  72. X32,
  73. X32,
  74. X32,
  75. X32,
  76. X32,
  77. X32,
  78. X32,
  79. X32,
  80. X32,
  81. X32,
  82. X32,
  83. X32,
  84. X32,
  85. X32,
  86. X32,
  87. X32,
  88. X32,
  89. X32,
  90. X32,
  91. X32,
  92. X32,
  93. X32,
  94. X32,
  95. X32,
  96. X32,
  97. X32,
  98. X32,
  99. X32,
  100. X32,
  101. X32,
  102. X32,
  103. X32,
  104. X32,
  105. X32,
  106. X32,
  107. X32,
  108. X32,
  109. X32,
  110. X32,
  111. X32,
  112. X32,
  113. X32,
  114. X32,
  115. X32,
  116. X32,
  117. X32,
  118. X32,
  119. X32,
  120. X32,
  121. X32,
  122. X32,
  123. X32,
  124. X32,
  125. X32,
  126. X32,
  127. X32,
  128. X32,
  129. X32,
  130. X32,
  131. X32,
  132. X32,
  133. X0,
  134. X1,
  135. X2,
  136. X3,
  137. X4,
  138. X5,
  139. X6,
  140. X7,
  141. X8,
  142. X9,
  143. X10,
  144. X11,
  145. X12,
  146. X13,
  147. X14,
  148. X15,
  149. X16,
  150. X17,
  151. X18,
  152. X19,
  153. X20,
  154. X21,
  155. X22,
  156. X23,
  157. X24,
  158. X25,
  159. X27,
  160. X28,
  161. X26,
  162. X32,
  163. X32,
  164. X32,
  165. X0,
  166. X1,
  167. X2,
  168. X3,
  169. X4,
  170. X5,
  171. X6,
  172. X7,
  173. X8,
  174. X9,
  175. X10,
  176. X11,
  177. X12,
  178. X13,
  179. X14,
  180. X15,
  181. X16,
  182. X17,
  183. X18,
  184. X19,
  185. X20,
  186. X21,
  187. X22,
  188. X23,
  189. X24,
  190. X25,
  191. X27,
  192. X28,
  193. X26,
  194. X32,
  195. X32,
  196. X32,
  197. X32,
  198. X32,
  199. X32,
  200. X32,
  201. X32,
  202. X32,
  203. X32,
  204. X32,
  205. X32,
  206. X32,
  207. X32,
  208. X32,
  209. X32,
  210. X32,
  211. X32,
  212. X32,
  213. X32,
  214. X32,
  215. X32,
  216. X32,
  217. X32,
  218. X32,
  219. X32,
  220. X32,
  221. X32,
  222. X32,
  223. X32,
  224. X32,
  225. X32,
  226. X32,
  227. X32,
  228. X32,
  229. X32,
  230. X32,
  231. X32,
  232. X32,
  233. X32,
  234. X32,
  235. X32,
  236. X32,
  237. X32,
  238. X32,
  239. X32,
  240. X32,
  241. X32,
  242. X32,
  243. X32,
  244. X32,
  245. X32,
  246. X32,
  247. X32,
  248. X32,
  249. X32,
  250. X32,
  251. X32,
  252. X32,
  253. X32,
  254. X32,
  255. X32,
  256. X32,
  257. X32,
  258. X32,
  259. X32,
  260. X32,
  261. X32,
  262. X32,
  263. X32,
  264. X32,
  265. X26,
  266. X27,
  267. X32,
  268. X32,
  269. X32,
  270. X32,
  271. X32,
  272. X32,
  273. X32,
  274. X32,
  275. X32,
  276. X32,
  277. X32,
  278. X32,
  279. X32,
  280. X32,
  281. X32,
  282. X32,
  283. X32,
  284. X28,
  285. X32,
  286. X32,
  287. X32,
  288. X32,
  289. X32,
  290. X32,
  291. X32,
  292. X32,
  293. X32,
  294. X32,
  295. X32,
  296. X32,
  297. X26,
  298. X27,
  299. X32,
  300. X32,
  301. X32,
  302. X32,
  303. X32,
  304. X32,
  305. X32,
  306. X32,
  307. X32,
  308. X32,
  309. X32,
  310. X32,
  311. X32,
  312. X32,
  313. X32,
  314. X32,
  315. X32,
  316. X28,
  317. X32,
  318. X32,
  319. X32,
  320. X32,
  321. X32,
  322. X32,
  323. X32,
  324. X};
  325. X
  326. XPRIVATE byteT dk8[256] = /* Map Danish ISO 646 to ISO 8859/1.*/
  327. X{
  328. X0000,/* 0/ 0    0    0   0  NUL (null)                                       */
  329. X0001,/* 0/ 1    1    1   1  SOH (start of heading)                           */
  330. X0002,/* 0/ 2    2    2   2  STX (start of text)                              */
  331. X0003,/* 0/ 3    3    3   3  ETX (end of text)                                */
  332. X0004,/* 0/ 4    4    4   4  EOT (end of transmission)                        */
  333. X0005,/* 0/ 5    5    5   5  ENQ (enquiry)                                    */
  334. X0006,/* 0/ 6    6    6   6  ACK (acknowledge)                                */
  335. X0007,/* 0/ 7    7    7   7  BEL (bell)                                       */
  336. X0010,/* 0/ 8   10    8   8  BS  (backspace)                                  */
  337. X0011,/* 0/ 9   11    9   9  HT  (horizontal tabulation)                      */
  338. X0012,/* 0/10   12   10   A  LF  (line feed)                                  */
  339. X0013,/* 0/11   13   11   B  VT  (vertical tabulation)                        */
  340. X0014,/* 0/12   14   12   C  FF  (form feed)                                  */
  341. X0015,/* 0/13   15   13   D  CR  (carriage return)                            */
  342. X0016,/* 0/14   16   14   E  SO  (shift out)                                  */
  343. X0017,/* 0/15   17   15   F  SI  (shift in)                                   */
  344. X0020,/* 1/ 0   20   16  10  DLE (data link escape)                           */
  345. X0021,/* 1/ 1   21   17  11  DC1 (device control 1)                           */
  346. X0022,/* 1/ 2   22   18  12  DC2 (device control 2)                           */
  347. X0023,/* 1/ 3   23   19  13  DC3 (device control 3)                           */
  348. X0024,/* 1/ 4   24   20  14  DC4 (device control 4)                           */
  349. X0025,/* 1/ 5   25   21  15  NAK (negative aknowledge)                        */
  350. X0026,/* 1/ 6   26   22  16  SYN (synchronous idle)                           */
  351. X0027,/* 1/ 7   27   23  17  ETB (end of transmission block)                  */
  352. X0030,/* 1/ 8   30   24  18  CAN (cancel)                                     */
  353. X0031,/* 1/ 9   31   25  19  EM  (end of medium)                              */
  354. X0032,/* 1/10   32   26  1A  SUB (substitute character)                       */
  355. X0033,/* 1/11   33   27  1B  ESC (escape)                                     */
  356. X0034,/* 1/12   34   28  1C  IS4/FS (information separator 4 / file separator)*/
  357. X0035,/* 1/13   35   29  1D  IS3/GS (information separator 3 / group separator) */
  358. X0036,/* 1/14   36   30  1E  IS2/RS (information separator 2 / record separator)*/
  359. X0037,/* 1/15   37   31  1F  IS1/US (information separator 1 / unit separator)*/
  360. X0040,/* 2/ 0   40   32  20  space                                            */
  361. X0041,/* 2/ 1   41   33  21  exclamation mark                                 */
  362. X0042,/* 2/ 2   42   34  22  quotation mark                                   */
  363. X0043,/* 2/ 3   43   35  23  number sign                                      */
  364. X0044,/* 2/ 4   44   36  24  dollar sign                                      */
  365. X0045,/* 2/ 5   45   37  25  percent sign                                     */
  366. X0046,/* 2/ 6   46   38  26  ampersand                                        */
  367. X0047,/* 2/ 7   47   39  27  apostrophe                                       */
  368. X0050,/* 2/ 8   50   40  28  left parenthesis                                 */
  369. X0051,/* 2/ 9   51   41  29  right parenthesis                                */
  370. X0052,/* 2/10   52   42  2A  asterisk                                         */
  371. X0053,/* 2/11   53   43  2B  plus sign                                        */
  372. X0054,/* 2/12   54   44  2C  comma                                            */
  373. X0055,/* 2/13   55   45  2D  hyphen, minus sign                               */
  374. X0056,/* 2/14   56   46  2E  full stop                                        */
  375. X0057,/* 2/15   57   47  2F  solidus                                          */
  376. X0060,/* 3/ 0   60   48  30  digit zero                                       */
  377. X0061,/* 3/ 1   61   49  31  digit one                                        */
  378. X0062,/* 3/ 2   62   50  32  digit two                                        */
  379. X0063,/* 3/ 3   63   51  33  digit three                                      */
  380. X0064,/* 3/ 4   64   52  34  digit four                                       */
  381. X0065,/* 3/ 5   65   53  35  digit five                                       */
  382. X0066,/* 3/ 6   66   54  36  digit six                                        */
  383. X0067,/* 3/ 7   67   55  37  digit seven                                      */
  384. X0070,/* 3/ 8   70   56  38  digit eight                                      */
  385. X0071,/* 3/ 9   71   57  39  digit nine                                       */
  386. X0072,/* 3/10   72   58  3A  colon                                            */
  387. X0073,/* 3/11   73   59  3B  semicolon                                        */
  388. X0074,/* 3/12   74   60  3C  less-than sign                                   */
  389. X0075,/* 3/13   75   61  3D  equals sign                                      */
  390. X0076,/* 3/14   76   62  3E  greater-than sign                                */
  391. X0077,/* 3/15   77   63  3F  question mark                                    */
  392. X0100,/* 4/ 0  100   64  40  commercial at                                    */
  393. X0101,/* 4/ 1  101   65  41  A                                                */
  394. X0102,/* 4/ 2  102   66  42  B                                                */
  395. X0103,/* 4/ 3  103   67  43  C                                                */
  396. X0104,/* 4/ 4  104   68  44  D                                                */
  397. X0105,/* 4/ 5  105   69  45  E                                                */
  398. X0106,/* 4/ 6  106   70  46  F                                                */
  399. X0107,/* 4/ 7  107   71  47  G                                                */
  400. X0110,/* 4/ 8  110   72  48  H                                                */
  401. X0111,/* 4/ 9  111   73  49  I                                                */
  402. X0112,/* 4/10  112   74  4A  J                                                */
  403. X0113,/* 4/11  113   75  4B  K                                                */
  404. X0114,/* 4/12  114   76  4C  L                                                */
  405. X0115,/* 4/13  115   77  4D  M                                                */
  406. X0116,/* 4/14  116   78  4E  N                                                */
  407. X0117,/* 4/15  117   79  4F  O                                                */
  408. X0120,/* 5/ 0  120   80  50  P                                                */
  409. X0121,/* 5/ 1  121   81  51  Q                                                */
  410. X0122,/* 5/ 2  122   82  52  R                                                */
  411. X0123,/* 5/ 3  123   83  53  S                                                */
  412. X0124,/* 5/ 4  124   84  54  T                                                */
  413. X0125,/* 5/ 5  125   85  55  U                                                */
  414. X0126,/* 5/ 6  126   86  56  V                                                */
  415. X0127,/* 5/ 7  127   87  57  W                                                */
  416. X0130,/* 5/ 8  130   88  58  X                                                */
  417. X0131,/* 5/ 9  131   89  59  Y                                                */
  418. X0132,/* 5/10  132   90  5A  Z                                                */
  419. X0306,/* 5/11  133   91  5B  left square bracket                              */
  420. X0330,/* 5/12  134   92  5C  reverse solidus                                  */
  421. X0305,/* 5/13  135   93  5D  right square bracket                             */
  422. X0136,/* 5/14  136   94  5E  circumflex accent                                */
  423. X0137,/* 5/15  137   95  5F  low line, underline                              */
  424. X0140,/* 6/ 0  140   96  60  grave accent                                     */
  425. X0141,/* 6/ 1  141   97  61  a                                                */
  426. X0142,/* 6/ 2  142   98  62  b                                                */
  427. X0143,/* 6/ 3  143   99  63  c                                                */
  428. X0144,/* 6/ 4  144  100  64  d                                                */
  429. X0145,/* 6/ 5  145  101  65  e                                                */
  430. X0146,/* 6/ 6  146  102  66  f                                                */
  431. X0147,/* 6/ 7  147  103  67  g                                                */
  432. X0150,/* 6/ 8  150  104  68  h                                                */
  433. X0151,/* 6/ 9  151  105  69  i                                                */
  434. X0152,/* 6/10  152  106  6A  j                                                */
  435. X0153,/* 6/11  153  107  6B  k                                                */
  436. X0154,/* 6/12  154  108  6C  l                                                */
  437. X0155,/* 6/13  155  109  6D  m                                                */
  438. X0156,/* 6/14  156  110  6E  n                                                */
  439. X0157,/* 6/15  157  111  6F  o                                                */
  440. X0160,/* 7/ 0  160  112  70  p                                                */
  441. X0161,/* 7/ 1  161  113  71  q                                                */
  442. X0162,/* 7/ 2  162  114  72  r                                                */
  443. X0163,/* 7/ 3  163  115  73  s                                                */
  444. X0164,/* 7/ 4  164  116  74  t                                                */
  445. X0165,/* 7/ 5  165  117  75  u                                                */
  446. X0166,/* 7/ 6  166  118  76  v                                                */
  447. X0167,/* 7/ 7  167  119  77  w                                                */
  448. X0170,/* 7/ 8  170  120  78  x                                                */
  449. X0171,/* 7/ 9  171  121  79  y                                                */
  450. X0172,/* 7/10  172  122  7A  z                                                */
  451. X0346,/* 7/11  173  123  7B  left curly bracket                               */
  452. X0370,/* 7/12  174  124  7C  vertical line                                    */
  453. X0345,/* 7/13  175  125  7D  right curly bracket                              */
  454. X0176,/* 7/14  176  126  7E  tilde                                            */
  455. X0177,/* 7/15  177  127  7F  DEL (delete)                                     */
  456. X0200,/* 8/ 0  200  128  80                                                   */
  457. X0201,/* 8/ 1  201  129  81                                                   */
  458. X0202,/* 8/ 2  202  130  82                                                   */
  459. X0203,/* 8/ 3  203  131  83                                                   */
  460. X0204,/* 8/ 4  204  132  84                                                   */
  461. X0205,/* 8/ 5  205  133  85                                                   */
  462. X0206,/* 8/ 6  206  134  86                                                   */
  463. X0207,/* 8/ 7  207  135  87                                                   */
  464. X0210,/* 8/ 8  210  136  88                                                   */
  465. X0211,/* 8/ 9  211  137  89                                                   */
  466. X0212,/* 8/10  212  138  8A                                                   */
  467. X0213,/* 8/11  213  139  8B                                                   */
  468. X0214,/* 8/12  214  140  8C                                                   */
  469. X0215,/* 8/13  215  141  8D                                                   */
  470. X0216,/* 8/14  216  142  8E                                                   */
  471. X0217,/* 8/15  217  143  8F                                                   */
  472. X0220,/* 9/ 0  220  144  90                                                   */
  473. X0221,/* 9/ 1  221  145  91                                                   */
  474. X0222,/* 9/ 2  222  146  92                                                   */
  475. X0223,/* 9/ 3  223  147  93                                                   */
  476. X0224,/* 9/ 4  224  148  94                                                   */
  477. X0225,/* 9/ 5  225  149  95                                                   */
  478. X0226,/* 9/ 6  226  150  96                                                   */
  479. X0227,/* 9/ 7  227  151  97                                                   */
  480. X0230,/* 9/ 8  230  152  98                                                   */
  481. X0231,/* 9/ 9  231  153  99                                                   */
  482. X0232,/* 9/10  232  154  9A                                                   */
  483. X0233,/* 9/11  233  155  9B                                                   */
  484. X0234,/* 9/12  234  156  9C                                                   */
  485. X0235,/* 9/13  235  157  9D                                                   */
  486. X0236,/* 9/14  236  158  9E                                                   */
  487. X0237,/* 9/15  237  159  9F                                                   */
  488. X0240,/*10/ 0  240  160  A0  NBSP (no-break space)                            */
  489. X0241,/*10/ 1  241  161  A1  inverted exclamation mark                        */
  490. X0242,/*10/ 2  242  162  A2  cent sign                                        */
  491. X0243,/*10/ 3  243  163  A3  pound sign                                       */
  492. X0244,/*10/ 4  244  164  A4  general currency sign                            */
  493. X0245,/*10/ 5  245  165  A5  yen sign                                         */
  494. X0246,/*10/ 6  246  166  A6  broken vertical line                             */
  495. X0247,/*10/ 7  247  167  A7  section sign                                     */
  496. X0250,/*10/ 8  250  168  A8  diaeresis                                        */
  497. X0251,/*10/ 9  251  169  A9  copyright sign                                   */
  498. X0252,/*10/10  252  170  AA  ordinal indicator, feminine                      */
  499. X0253,/*10/11  253  171  AB  angle quotation mark left                        */
  500. X0254,/*10/12  254  172  AC  not sign                                         */
  501. X0255,/*10/13  255  173  AD  soft hyphen                                      */
  502. X0256,/*10/14  256  174  AE  registered sign                                  */
  503. X0257,/*10/15  257  175  AF  macron                                           */
  504. X0260,/*11/ 0  260  176  B0  degree sign                                      */
  505. X0261,/*11/ 1  261  177  B1  plus or minus sign                               */
  506. X0262,/*11/ 2  262  178  B2  superscript two                                  */
  507. X0263,/*11/ 3  263  179  B3  superscript three                                */
  508. X0264,/*11/ 4  264  180  B4  acute accent                                     */
  509. X0265,/*11/ 5  265  181  B5  micro sign                                       */
  510. X0266,/*11/ 6  266  182  B6  pilcrow                                          */
  511. X0267,/*11/ 7  267  183  B7  middle dot                                       */
  512. X0270,/*11/ 8  270  184  B8  cedilla                                          */
  513. X0271,/*11/ 9  271  185  B9  superscript one                                  */
  514. X0272,/*11/10  272  186  BA  ordinal indicator, masculine                     */
  515. X0273,/*11/11  273  187  BB  angle quotation mark right                       */
  516. X0274,/*11/12  274  188  BC  fraction one-quarter                             */
  517. X0275,/*11/13  275  189  BD  fraction one-half                                */
  518. X0276,/*11/14  276  190  BE  fraction three-quarters                          */
  519. X0277,/*11/15  277  191  BF  inverted question mark                           */
  520. X0300,/*12/ 0  300  192  C0  capital A with grave accent                      */
  521. X0301,/*12/ 1  301  193  C1  capital A with acute accent                      */
  522. X0302,/*12/ 2  302  194  C2  capital A with circumflex accent                 */
  523. X0303,/*12/ 3  303  195  C3  capital A with tilde                             */
  524. X0304,/*12/ 4  304  196  C4  capital A with diaeresis or umlaut mark          */
  525. X0305,/*12/ 5  305  197  C5  capital A with ring                              */
  526. X0306,/*12/ 6  306  198  C6  capital AE diphthong                             */
  527. X0307,/*12/ 7  307  199  C7  capital C with cedilla                           */
  528. X0310,/*12/ 8  310  200  C8  capital E with grave accent                      */
  529. X0311,/*12/ 9  311  201  C9  capital E with acute accent                      */
  530. X0312,/*12/10  312  202  CA  capital E with circumflex accent                 */
  531. X0313,/*12/11  313  203  CB  capital E with diaeresis or umlaut mark          */
  532. X0314,/*12/12  314  204  CC  capital I with grave accent                      */
  533. X0315,/*12/13  315  205  CD  capital I with acute accent                      */
  534. X0316,/*12/14  316  206  CE  capital I with circumflex accent                 */
  535. X0317,/*12/15  317  207  CF  capital I with diaeresis or umlaut mark          */
  536. X0320,/*13/ 0  320  208  D0  capital D with stroke, Icelandic eth             */
  537. X0321,/*13/ 1  321  209  D1  capital N with tilde                             */
  538. X0322,/*13/ 2  322  210  D2  capital O with grave accent                      */
  539. X0323,/*13/ 3  323  211  D3  capital O with acute accent                      */
  540. X0324,/*13/ 4  324  212  D4  capital O with circumflex accent                 */
  541. X0325,/*13/ 5  325  213  D5  capital O with tilde                             */
  542. X0326,/*13/ 6  326  214  D6  capital O with diaeresis or umlaut mark          */
  543. X0327,/*13/ 7  327  215  D7  multiplication sign                              */
  544. X0330,/*13/ 8  330  216  D8  capital O with slash                             */
  545. X0331,/*13/ 9  331  217  D9  capital U with grave accent                      */
  546. X0332,/*13/10  332  218  DA  capital U with acute accent                      */
  547. X0333,/*13/11  333  219  DB  capital U with circumflex accent                 */
  548. X0334,/*13/12  334  220  DC  capital U with diaeresis or umlaut mark          */
  549. X0335,/*13/13  335  221  DD  capital Y with acute accent                      */
  550. X0336,/*13/14  336  222  DE  capital thorn, Icelandic                         */
  551. X0337,/*13/15  337  223  DF  small sharp s, German                            */
  552. X0340,/*14/ 0  340  224  E0  small a with grave accent                        */
  553. X0341,/*14/ 1  341  225  E1  small a with acute accent                        */
  554. X0342,/*14/ 2  342  226  E2  small a with circumflex accent                   */
  555. X0343,/*14/ 3  343  227  E3  small a with tilde                               */
  556. X0344,/*14/ 4  344  228  E4  small a with diaeresis or umlaut mark            */
  557. X0345,/*14/ 5  345  229  E5  small a with ring                                */
  558. X0346,/*14/ 6  346  230  E6  small ae diphthong                               */
  559. X0347,/*14/ 7  347  231  E7  small c with cedilla                             */
  560. X0350,/*14/ 8  350  232  E8  small e with grave accent                        */
  561. X0351,/*14/ 9  351  233  E9  small e with acute accent                        */
  562. X0352,/*14/10  352  234  EA  small e with circumflex accent                   */
  563. X0353,/*14/11  353  235  EB  small e with diaeresis or umlaut mark            */
  564. X0354,/*14/12  354  236  EC  small i with grave accent                        */
  565. X0355,/*14/13  355  237  ED  small i with acute accent                        */
  566. X0356,/*14/14  356  238  EE  small i with circumflex accent                   */
  567. X0357,/*14/15  357  239  EF  small i with diaeresis or umlaut mark            */
  568. X0360,/*15/ 0  360  240  F0  small d with stroke, Icelandic eth               */
  569. X0361,/*15/ 1  361  241  F1  small n with tilde                               */
  570. X0362,/*15/ 2  362  242  F2  small o with grave accent                        */
  571. X0363,/*15/ 3  363  243  F3  small o with acute accent                        */
  572. X0364,/*15/ 4  364  244  F4  small o with circumflex accent                   */
  573. X0365,/*15/ 5  365  245  F5  small o with tilde                               */
  574. X0366,/*15/ 6  366  246  F6  small o with diaeresis or umlaut mark            */
  575. X0367,/*15/ 7  367  247  F7  division sign                                    */
  576. X0370,/*15/ 8  370  248  F8  small o with slash                               */
  577. X0371,/*15/ 9  371  249  F9  small u with grave accent                        */
  578. X0372,/*15/10  372  250  FA  small u with acute accent                        */
  579. X0373,/*15/11  373  251  FB  small u with circumflex accent                   */
  580. X0374,/*15/12  374  252  FC  small u with diaeresis or umlaut mark            */
  581. X0375,/*15/13  375  253  FD  small y with acute accent                        */
  582. X0376,/*15/14  376  254  FE  small thorn, Icelandic                           */
  583. X0377,/*15/15  377  255  FF  small y with diaeresis or umlaut mark            */
  584. X};
  585. X
  586. X#include "78common.h"
  587. X
  588. X/* Different sections in a file: */
  589. X#define S_HDR  1 /* News article header.*/
  590. X#define S_BODY 2 /* News article body.*/
  591. X#define S_SIG  3 /* News article signature.*/
  592. X
  593. XPRIVATE double   attack = 0.65;   /* Smoothing factor.*/
  594. XPRIVATE double   blank  = 0.7;    /* Scale attack/decay on blank lines.*/
  595. XPRIVATE double   bodval = -200.0; /* Score at start of body.*/
  596. XPRIVATE double   colon  = 0.5;    /* Scale attack/decay after colon.*/
  597. XPRIVATE boolT    debug = FALSE;   /* Debug flag.*/
  598. XPRIVATE double   decay = 0.67;    /* Smoothing factor.*/
  599. XPRIVATE boolT    fixbody = FALSE; /* Ordinary file, no header or signature.*/
  600. XPRIVATE double   headval = 0.0;   /* For header values.*/
  601. XPRIVATE boolT    mailbox = FALSE; /* Converting a mailbox.*/
  602. XPRIVATE double   pound1 = -350.0; /* After # at beginning of line.*/
  603. XPRIVATE unsigned siglns = 9;      /* Max lines in a signature.*/
  604. XPRIVATE double   thresh = 0.0;    /* Score above this is Danish.*/
  605. XPRIVATE triDifT  dkustt[TRIMAX + 1];/* Trigram difference table.*/
  606. X
  607. XPRIVATE bStrT dkwords[] = /* These are always Danish.*/
  608. X   {
  609. X   NULBSTR
  610. X   };
  611. X
  612. XPRIVATE bStrT uswords[] = /* These are never Danish.*/
  613. X   {
  614. X   S("[]"),
  615. X   S("[The"),
  616. X   NULBSTR
  617. X   };
  618. X
  619. X#include "78heur.h"
  620. X
  621. X/* dkus - run heuristics on one file */
  622. X
  623. XPRIVATE void dkus (is, fn)
  624. XR9 streamT is; /* Input stream.*/
  625. X   bStrT   fn; /* File name.*/
  626. X
  627. X/* Function:
  628. X *    Copy file to standard output, converting to ISO 8859/1.
  629. X * Algorithm:
  630. X *    Read each line.  Switch on section and look for section
  631. X *    transitions.  Step through the line.  Look for section matches.
  632. X *    Call dif78() on each word.  Compute score.  If word looks Danish,
  633. X *    convert it.  Write line.
  634. X * Returns:
  635. X *    
  636. X * Notes:
  637. X *    
  638. X */
  639. X{
  640. XR2 rcharT   b;             /* Current input byte.*/
  641. XR4 int      i;             /* General putpose.*/
  642. X   double   cum = 0.0;     /* Cumulative score.*/
  643. X   unsigned ln = 0;        /* Input line number.*/
  644. X   int      lns = -1;      /* Value from Lines: header field; -1 = unknown.*/
  645. XR8 unsigned sigln = 1;     /* Line number in signature.*/
  646. XR5 bStrT    p1;            /* Rest of line after special match.*/
  647. XR1 bStrT    lp;            /* Steps through lb[].*/
  648. XR7 boolT    sigbeg;        /* Line looks like start of signature.*/
  649. XR3 bStrT    wp = NULBSTR;  /* Points to start of word.*/
  650. XR6 unsigned sect;          /* Current section.*/
  651. X   byteT    lb[MLINE + 1]; /* Line buffer.*/
  652. X
  653. Xsect = (fixbody ? S_BODY : S_HDR);
  654. Xlb[0] = ' ';
  655. Xwhile (NULBSTR != (getlin ((lp = &lb[1]), MLINE, is, fn, &ln, 0)))
  656. X   {
  657. X   if (mailbox && (NULBSTR != prefix (S("From "), lp)))
  658. X      {
  659. X      cum = 0.0;
  660. X      ln = 1;
  661. X      lns = -1;
  662. X      sect = S_HDR;
  663. X      sigln = 1;
  664. X      sigbeg = FALSE;
  665. X      }
  666. X   else
  667. X      sigbeg = SigBegP (lp);
  668. X   switch (sect)
  669. X      {
  670. X      case S_HDR:
  671. X         if (EOS == B(*lp))
  672. X            {
  673. X            sect = S_BODY;
  674. X            cum = bodval;
  675. X            ln = 0;
  676. X            }
  677. X         else
  678. X            {
  679. X            if (NULBSTR != (p1 = prefix (S("Lines: "), lp)))
  680. X               (void) a2i (p1, NULBSTR, TRUE, &lns, (bStrT *) NULL);
  681. X            if (NULBSTR != (p1 = bStrChr (lp, ':')))
  682. X               {
  683. X               cum = headval;
  684. X               lp = p1 + 1;
  685. X               }
  686. X            }
  687. X         break;
  688. X      case S_BODY:
  689. X         if (sigbeg || (!fixbody && (lns > siglns) && (ln > (lns - siglns))))
  690. X            sect = S_SIG;
  691. X         else
  692. X            {
  693. X            for (; '>' == B(*lp); ++lp)
  694. X               ;
  695. X            if (('#' == B(*lp)) || ('X' == B(*lp)))
  696. X               cum = MIN (cum, pound1);
  697. X            }
  698. X         break;
  699. X      case S_SIG:
  700. X         if (sigbeg)
  701. X            sigln = 1;
  702. X         else if (sigln <= siglns)
  703. X            ++sigln;
  704. X         else
  705. X            {
  706. X            sigln = 1;
  707. X            sect = S_BODY;
  708. X            }
  709. X         break;
  710. X      default:
  711. X         malf1 (eIntern, "dkus 1");
  712. X         break;
  713. X      }
  714. X   if (EOS == B(*lp)) cum *= blank * ((cum > thresh) ? decay : attack);
  715. X   do
  716. X      {
  717. X      b = B(*lp);
  718. X      if ((NULBSTR != (p1 = BraceP (lp, sect))) ||
  719. X          (NULBSTR != (p1 = UunetP (lp))) ||
  720. X          (NULBSTR != (p1 = IPP (lp))) ||
  721. X          (NULBSTR != (p1 = InArtP (lp, sect))) ||
  722. X          (NULBSTR != (p1 = GrafP (lp, sect))) ||
  723. X          (NULBSTR != (p1 = PipeP (lp, sect))) ||
  724. X          (NULBSTR != (p1 = EndP (lp, sect, S(") writes:")))) ||
  725. X          (NULBSTR != (p1 = EndP (lp, sect, S(" \\n\\")))) ||
  726. X          (NULBSTR != (p1 = LaTeXP (lp))))
  727. X         {
  728. X         lp = p1;
  729. X         wp = NULBSTR;
  730. X         }
  731. X      else
  732. X         {
  733. X         if (byte2t[b] <= TRIHI)
  734. X            {
  735. X            if (NULBSTR == wp) wp = lp;
  736. X            }
  737. X         else
  738. X            {
  739. X            if (NULBSTR != wp)
  740. X               {
  741. X               i = dif78 (wp, lp, dkustt);
  742. X               cum *= ((i > 0) ? attack : decay);
  743. X               cum += i;
  744. X               if (((cum > thresh) && !wordp (wp, lp, uswords)) ||
  745. X                   wordp (wp, lp, dkwords))
  746. X                  {
  747. X                  for (p1 = wp; p1 != lp; ++p1)
  748. X                     *p1 = dk8[B(*p1)];
  749. X                  }
  750. X               if (debug)
  751. X                  FPRINTF (stderr, "%c%6.0f %.*s\n", "?hbsf"[sect], cum,
  752. X                           lp - wp, wp);
  753. X               wp = NULBSTR;
  754. X               if (':' == b)
  755. X                  cum *= colon * ((cum > thresh) ? decay : attack);
  756. X               }
  757. X            }
  758. X         ++lp;
  759. X         }
  760. X      }
  761. X   while (EOS != b);
  762. X   puts (&lb[1]);
  763. X   }
  764. X}
  765. X
  766. X/* main - main function                            */
  767. X
  768. XPUBLIC int main (argc, argv)
  769. X   int    argc; /* Number of arguments.*/
  770. XR3 bStrT *argv; /* Points to array of argument strings.*/
  771. X
  772. X/* Function:
  773. X *    
  774. X * Algorithm:
  775. X *    Decode args.  Initialize.  Call dkus().
  776. X * Notes:
  777. X *    
  778. X */
  779. X
  780. X{
  781. XR1     rcharT c;     /* Option letter.*/
  782. XR2     bStrT cp;     /* Steps through args.*/
  783. Xextern int optind;   /* See getopt (3).*/
  784. Xextern cStrT optarg; /* See getopt (3).*/
  785. X
  786. Xwhile (EOF != (c = getopt (argc, (cStrT *) argv, "#:A:B:D:b:c:dfh:ms:t:")))
  787. X   {
  788. X   switch (c)
  789. X      {
  790. X      case '?':
  791. X         usage();
  792. X         break;
  793. X      case '#':
  794. X         pound1 = ma2d ((bStrT) optarg, NULBSTR, FALSE, "# Value",
  795. X                       (bStrT *) NULL);
  796. X         break;
  797. X      case 'A':
  798. X         attack = mra2d ((bStrT) optarg, NULBSTR, FALSE, "Attack", 0.001, 0.999,
  799. X                       (bStrT *) NULL);
  800. X         break;
  801. X      case 'B':
  802. X         blank = ma2d ((bStrT) optarg, NULBSTR, FALSE, S("Blank smoothing"),
  803. X                       (bStrT *) NULL);
  804. X         break;
  805. X      case 'D':
  806. X         decay = mra2d ((bStrT) optarg, NULBSTR, FALSE, "Decay", 0.001, 0.999,
  807. X                       (bStrT *) NULL);
  808. X         break;
  809. X      case 'b':
  810. X         bodval = ma2d ((bStrT) optarg, NULBSTR, FALSE, "Body Value",
  811. X                       (bStrT *) NULL);
  812. X         break;
  813. X      case 'c':
  814. X         colon = ma2d ((bStrT) optarg, NULBSTR, FALSE, S("Colon Smoothing"),
  815. X                       (bStrT *) NULL);
  816. X         break;
  817. X      case 'd':
  818. X         debug = TRUE;
  819. X         break;
  820. X      case 'f':
  821. X         fixbody = TRUE;
  822. X         break;
  823. X      case 'h':
  824. X         headval = ma2d ((bStrT) optarg, NULBSTR, FALSE, S("Header Value"),
  825. X                         (bStrT *) NULL);
  826. X         break;
  827. X      case 'm':
  828. X         mailbox = TRUE;
  829. X         break;
  830. X      case 's':
  831. X         siglns = mra2u ((bStrT) optarg, NULBSTR, FALSE, "Max signature lines",
  832. X                         (unsigned) 1, (unsigned) 99, (bStrT *) NULL);
  833. X         break;
  834. X      case 't':
  835. X         thresh = ma2d ((bStrT) optarg, NULBSTR, FALSE, "Threshold",
  836. X                       (bStrT *) NULL);
  837. X         break;
  838. X      default:
  839. X         malf1 (eIntern, "main 1");
  840. X         break;
  841. X      }
  842. X   }
  843. Xargv += optind;
  844. Xcp = *argv++;
  845. Xif (NULBSTR != cp) usage();
  846. Xipath();
  847. Xmrdtri (S("dkus"), (bStrT) dkustt);
  848. Xdkus (stdin, S("Standard Input"));
  849. Xmfflush (stdout, "Standard Output");
  850. Xexit (SUCCESS);
  851. X
  852. X#ifdef lint
  853. Xreturn (SUCCESS);
  854. X#endif
  855. X}
  856. END_OF_FILE
  857. if test 30798 -ne `wc -c <'78dkus.c'`; then
  858.     echo shar: \"'78dkus.c'\" unpacked with wrong size!
  859. fi
  860. # end of '78dkus.c'
  861. fi
  862. if test -f '78triFreq.c' -a "${1}" != "-c" ; then 
  863.   echo shar: Will not clobber existing file \"'78triFreq.c'\"
  864. else
  865. echo shar: Extracting \"'78triFreq.c'\" \(4268 characters\)
  866. sed "s/^X//" >'78triFreq.c' <<'END_OF_FILE'
  867. X/*
  868. X * 78triFreq - compute trigram frequencies
  869. X */
  870. X
  871. X#ifndef lint
  872. Xstatic char _cpyrgt[] = "Copyright 1989 Howard Lee Gayle";
  873. X#endif lint
  874. X
  875. X/*
  876. X * This program is free software; you can redistribute it and/or modify
  877. X * it under the terms of the GNU General Public License version 1,
  878. X * as published by the Free Software Foundation.
  879. X *
  880. X * This program is distributed in the hope that it will be useful,
  881. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  882. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  883. X * GNU General Public License for more details.
  884. X *
  885. X * You should have received a copy of the GNU General Public License
  886. X * along with this program; if not, write to the Free Software
  887. X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  888. X */
  889. X
  890. X#include <stdio.h>
  891. X#include <howard/port.h>
  892. X#include <howard/version.h>
  893. X#include <howard/usage.h>
  894. X
  895. XMAINVER ("@(#)$Header: 78triFreq.c,v 2.2 89/08/25 11:15:35 howard Exp $");
  896. XUSAGE ("encodings < filenames > trigram-frequencies");
  897. X
  898. X#include <string.h>
  899. X#include <howard/malf.h>
  900. X#include <howard/registers.i>
  901. X#include "cz.h"
  902. X#include "78.h"
  903. X#include "78code.h"
  904. X
  905. XPRIVATE double tt;                  /* Total number of trigrams.*/
  906. XPRIVATE double tricnt[TRIMAX + 1]; /* Trigram counts.*/
  907. X
  908. X/* doword - process one word */
  909. X
  910. XPRIVATE void doword (wp)
  911. XR1 bStrT wp; /* Points to word.*/
  912. X
  913. X/* Function:
  914. X *    Increment the count for each trigram in the word.
  915. X * Algorithm:
  916. X *    Step through the word.
  917. X * Returns:
  918. X *    
  919. X * Notes:
  920. X *    1) Word must already be converted to trigram codes.
  921. X *    2) wp[-1] == TRIBEG.
  922. X *    3) Word is terminated with TRIEND.
  923. X */
  924. X{
  925. Xdo
  926. X   {
  927. X   tricnt[TOTRI (wp[0], wp[1], wp[2])] += 1.0;
  928. X   tt += 1.0;
  929. X   ++wp;
  930. X   }
  931. Xwhile (TRIEND != wp[1]);
  932. X}
  933. X
  934. X/* main - main function                            */
  935. X
  936. XPUBLIC int main (argc, argv)
  937. X   int    argc; /* Number of arguments.*/
  938. XR4 bStrT *argv; /* Points to array of argument strings.*/
  939. X
  940. X/* Function:
  941. X *    
  942. X * Algorithm:
  943. X *    Loop reading each line from stdin.  Treat it as a path name and
  944. X *    open it.  Call doword() on each word in file.
  945. X *    Compute scaling factor (s) for an implied denominator of 2^31 - 1.
  946. X *    Compute max frequency (m) and number of digits to print it (d).
  947. X *    Loop through trigram count vector and output each frequency, along
  948. X *    with the trigram in printable form.
  949. X * Notes:
  950. X *    1) Every 1000 input files, write the file number and total trigrams
  951. X *       counted so far.  This shows progress is being made, since
  952. X *       running it on a lot of files can take hours.
  953. X */
  954. X
  955. X{
  956. XR5 int d;            /* Max digits in count.*/
  957. XR1 int i;            /* General purpose.*/
  958. XR3 streamT is;       /* Input stream.*/
  959. X   unsigned ln = 0;  /* Input line number.*/
  960. X   double m = 0;     /* Max frequency.*/
  961. X   double s;         /* Scaling factor.*/
  962. XR2 bStrT wp;         /* Steps through wb[].*/
  963. X   byteT fnb[MFILE]; /* File name buffer.*/
  964. X   byteT wb[MLINE];  /* Word buffer.*/
  965. X
  966. Xif (2 != argc) usage();
  967. Xrdcode (argv[1]);
  968. Xwb[0] = TRIBEG;
  969. Xwp = &wb[1];
  970. Xwhile (NULBSTR != getlin (fnb, MFILE, stdin, S("Standard input"), &ln, 0))
  971. X   {
  972. X   is = fopen (fnb, "r");
  973. X   if (NULSTRM == is)
  974. X      malf0 ("%s: Can not open", fnb);
  975. X   else
  976. X      {
  977. X      while (EOF != (i = getc (is)))
  978. X         {
  979. X         i = byte2t[i];
  980. X         if (i <= TRIHI)
  981. X            *wp++ = i;
  982. X         else
  983. X            {
  984. X            if (wp != &wb[1])
  985. X               {
  986. X               *wp = TRIEND;
  987. X               doword (wb);
  988. X               wp = &wb[1];
  989. X               }
  990. X            }
  991. X         }
  992. X      if (ferror (is)) malf1 ("%s: Read error", fnb);
  993. X      mfclose (is, fnb);
  994. X      }
  995. X   if (0 == (ln % 1000))
  996. X      {
  997. X      FPRINTF (stderr, "%u %.0f\n", ln, tt);
  998. X      mfflush (stderr, S("Standard Error"));
  999. X      }
  1000. X   }
  1001. Xif (0.0 != tt)
  1002. X   {
  1003. X   PRINTF ("; Total trigrams: %.0f\n\n", tt);
  1004. X   s = 2147483647.0 / tt; /* 2^31 - 1.*/
  1005. X   for (i = 0; i <= TRIMAX; ++i)
  1006. X      if (tricnt[i] > m) m = tricnt[i];
  1007. X   SPRINTF ((cStrT) wb, "%.0f", m * s);
  1008. X   d = strlen ((cStrT) wb);
  1009. X   for (i = 0; i <= TRIMAX; ++i)
  1010. X      {
  1011. X      if (0.0 != tricnt[i])
  1012. X         PRINTF ("%*.0f %c%c%c\n", d, tricnt[i] * s,
  1013. X                 t2byte[31 & (i >> 5)], t2byte[i >> 10], t2byte[31 & i]);
  1014. X      }
  1015. X   mfflush (stdout, S("Standard Output"));
  1016. X   }
  1017. Xexit (SUCCESS);
  1018. X
  1019. X#ifdef lint
  1020. Xreturn (SUCCESS);
  1021. X#endif
  1022. X}
  1023. END_OF_FILE
  1024. if test 4268 -ne `wc -c <'78triFreq.c'`; then
  1025.     echo shar: \"'78triFreq.c'\" unpacked with wrong size!
  1026. fi
  1027. # end of '78triFreq.c'
  1028. fi
  1029. if test -f 'MakeCommon' -a "${1}" != "-c" ; then 
  1030.   echo shar: Will not clobber existing file \"'MakeCommon'\"
  1031. else
  1032. echo shar: Extracting \"'MakeCommon'\" \(1187 characters\)
  1033. sed "s/^X//" >'MakeCommon' <<'END_OF_FILE'
  1034. X# MakeCommon - common definitions for uMakefile and Makefile for cz
  1035. X#
  1036. X# $Header$
  1037. X#
  1038. X# Copyright 1989 Howard Lee Gayle
  1039. X# This file is written in the ISO 8859/1 character set.
  1040. X#
  1041. X# This program is free software; you can redistribute it and/or modify
  1042. X# it under the terms of the GNU General Public License version 1,
  1043. X# as published by the Free Software Foundation.
  1044. X#
  1045. X# This program is distributed in the hope that it will be useful,
  1046. X# but WITHOUT ANY WARRANTY; without even the implied warranty of
  1047. X# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1048. X# GNU General Public License for more details.
  1049. X#
  1050. X# You should have received a copy of the GNU General Public License
  1051. X# along with this program; if not, write to the Free Software
  1052. X# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1053. X
  1054. X# Copy stdin to stdout.
  1055. XCAT=cat
  1056. X
  1057. X# Change mode of a file.
  1058. XCHMOD=chmod
  1059. X
  1060. X# Get a file from the distribution directory.
  1061. XDISTI=mkDistI
  1062. X
  1063. X# Macro processor.
  1064. XM4=m4
  1065. X
  1066. X# Remove a file.
  1067. XRM=zap -f
  1068. X
  1069. X# Stream editor.
  1070. XSED=sed
  1071. X
  1072. X# Uncompress if necessary and check out from RCS or SCCS.
  1073. XUNCMPRS=mkUncmprs
  1074. X
  1075. X# C include file search path.
  1076. XINCLUDES=-I/usr/local/local-include -I/usr/local/free/howard/0/include
  1077. END_OF_FILE
  1078. if test 1187 -ne `wc -c <'MakeCommon'`; then
  1079.     echo shar: \"'MakeCommon'\" unpacked with wrong size!
  1080. fi
  1081. # end of 'MakeCommon'
  1082. fi
  1083. if test -f 'T-61.p4' -a "${1}" != "-c" ; then 
  1084.   echo shar: Will not clobber existing file \"'T-61.p4'\"
  1085. else
  1086. echo shar: Extracting \"'T-61.p4'\" \(2817 characters\)
  1087. sed "s/^X//" >'T-61.p4' <<'END_OF_FILE'
  1088. X% T.61.p4 - PostScript for cz0 for CCITT T.61.
  1089. X%
  1090. X% $Header: T-61.p4,v 1.1 89/08/04 16:41:23 howard Exp $
  1091. X%
  1092. X% Copyright 1989 Howard Lee Gayle
  1093. X% This file is written in the ISO 8859/1 character set.
  1094. X%
  1095. X% This program is free software; you can redistribute it and/or modify
  1096. X% it under the terms of the GNU General Public License version 1,
  1097. X% as published by the Free Software Foundation.
  1098. X%
  1099. X% This program is distributed in the hope that it will be useful,
  1100. X% but WITHOUT ANY WARRANTY; without even the implied warranty of
  1101. X% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1102. X% GNU General Public License for more details.
  1103. X%
  1104. X% You should have received a copy of the GNU General Public License
  1105. X% along with this program; if not, write to the Free Software
  1106. X% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1107. X
  1108. Xinclude(ps-abbrev.m4)
  1109. Xinclude(T-61.m4)
  1110. X
  1111. X/CharHeight % (character) CharHeight height
  1112. X   {% def
  1113. X   gsave
  1114. X      newpath
  1115. X      0 0 moveto
  1116. X      true charpath flattenpath pathbbox
  1117. X   grestore
  1118. X   4 1 roll PPOP PPOP PPOP
  1119. X   }PBIND PDEF
  1120. X
  1121. X/@ % (accent) (character) @
  1122. X   {% def
  1123. X   /AC exch PDEF % Accented character.
  1124. X   /DM exch PDEF % Diacritical mark.
  1125. X   currentpoint PPOP % Push current x.
  1126. X   AC PSHOW % Show character to be accented.
  1127. X   gsave % Come back here after printing accent.
  1128. X   currentpoint PPOP % Push current x.
  1129. X   sub % Negative width of character.
  1130. X   DM stringwidth PPOP % Push width of accent.
  1131. X   sub % Negative width of character plus accent.
  1132. X   2 div % Half.
  1133. X   AC CharHeight
  1134. X   (x)CharHeight
  1135. X   sub % Subtract x height.
  1136. X   rmoveto % Move to left and up.
  1137. X   DM PSHOW % Add accent.
  1138. X   grestore
  1139. X   }PBIND PDEF
  1140. X
  1141. X/@Y % (accent) (character) delta-y @Y
  1142. X   {% def
  1143. X   /DY exch PDEF % Delta Y.
  1144. X   /AC exch PDEF % Accented character.
  1145. X   /DM exch PDEF % Diacritical mark.
  1146. X   currentpoint PPOP % Push current x.
  1147. X   AC PSHOW % Show character to be accented.
  1148. X   gsave % Come back here after printing accent.
  1149. X   currentpoint PPOP % Push current x.
  1150. X   sub % Negative width of character.
  1151. X   DM stringwidth PPOP % Push width of accent.
  1152. X   sub % Negative width of character plus accent.
  1153. X   2 div % Half.
  1154. X   DY Size mul
  1155. X   rmoveto % Move to left and up.
  1156. X   DM PSHOW % Add accent.
  1157. X   grestore
  1158. X   }PBIND PDEF
  1159. X
  1160. X/@0{0 @Y}PBIND PDEF
  1161. X
  1162. X/Kern % (second-char) distance (first-char) Kern
  1163. X   {% def
  1164. X   PSHOW
  1165. X   Size mul neg 0 rmoveto
  1166. X   PSHOW
  1167. X   }PBIND def
  1168. X
  1169. X/@O % (accent) DeltaY DeltaX (character) Overlap
  1170. X   {% def
  1171. X   currentpoint PPOP % (accent) DeltaY DeltaX (character) current-x
  1172. X   exch PSHOW % (accent) DeltaY DeltaX current-x
  1173. X   gsave % Come back here after printing accent.
  1174. X   currentpoint PPOP % (accent) DeltaY DeltaX old-x current-x
  1175. X   sub % (accent) DeltaY DeltaX -width
  1176. X   exch Size mul add % (accent) DeltaY dx
  1177. X   exch Size mul % (accent) dx dy
  1178. X   rmoveto % (accent)
  1179. X   PSHOW
  1180. X   grestore
  1181. X   }PBIND PDEF
  1182. END_OF_FILE
  1183. if test 2817 -ne `wc -c <'T-61.p4'`; then
  1184.     echo shar: \"'T-61.p4'\" unpacked with wrong size!
  1185. fi
  1186. # end of 'T-61.p4'
  1187. fi
  1188. if test -f 'b.bib' -a "${1}" != "-c" ; then 
  1189.   echo shar: Will not clobber existing file \"'b.bib'\"
  1190. else
  1191. echo shar: Extracting \"'b.bib'\" \(1926 characters\)
  1192. sed "s/^X//" >'b.bib' <<'END_OF_FILE'
  1193. X% b.bib - bibliography
  1194. X%
  1195. X% Copyright 1989 Howard Lee Gayle
  1196. X% This file is written in the ISO 8859/1 character set.
  1197. X%
  1198. X% $Header: b.bib,v 1.5 89/09/22 07:44:48 howard Exp $
  1199. X%
  1200. X% This program is free software; you can redistribute it and/or modify
  1201. X% it under the terms of the GNU General Public License version 1,
  1202. X% as published by the Free Software Foundation.
  1203. X%
  1204. X% This program is distributed in the hope that it will be useful,
  1205. X% but WITHOUT ANY WARRANTY; without even the implied warranty of
  1206. X% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1207. X% GNU General Public License for more details.
  1208. X%
  1209. X% You should have received a copy of the GNU General Public License
  1210. X% along with this program; if not, write to the Free Software
  1211. X% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1212. X@book{Auden,
  1213. X   author = "W. H. Auden",
  1214. X   title = "Selected poetry of W. H. Auden",
  1215. X   publisher = "Vintage Books",
  1216. X   year = "1971",
  1217. X   address = "New York",
  1218. X   edition = "second"}
  1219. X@misc{Gunnel,
  1220. X   author = {Gunnel K{\"a}llgren},
  1221. X   howpublished = "Personal communcation",
  1222. X   month = "August",
  1223. X   year = "1989"}
  1224. X@manual{ISO:646,
  1225. X   title = "International Standard ISO 646,
  1226. X            Information processing---ISO 7-bit
  1227. X            coded character set for information interchange",
  1228. X   organization = "International Organization for Standardization",
  1229. X   edition = "second",
  1230. X   month = "July",
  1231. X   year = "1983"}
  1232. X@manual{SWASCII,
  1233. X   title = "Svensk standard SS~63~61~27,
  1234. X            Data representation---Swedish 7-bit
  1235. X            coded character set for data interchange",
  1236. X   organization = "Standardiseringskommissionen i Sverige",
  1237. X   edition = "second",
  1238. X   month = "April",
  1239. X   year = "1984"}
  1240. X@manual{Xerox,
  1241. X   title = "Xerox System Integration Standard XSIS~058404,
  1242. X            Character Code Standard",
  1243. X   organization = "Xerox Corporation",
  1244. X   address = "Stamford, Connecticut 10904, USA",
  1245. X   month = "April",
  1246. X   year = "1984"}
  1247. END_OF_FILE
  1248. if test 1926 -ne `wc -c <'b.bib'`; then
  1249.     echo shar: \"'b.bib'\" unpacked with wrong size!
  1250. fi
  1251. # end of 'b.bib'
  1252. fi
  1253. if test -f 'bytefreq.1' -a "${1}" != "-c" ; then 
  1254.   echo shar: Will not clobber existing file \"'bytefreq.1'\"
  1255. else
  1256. echo shar: Extracting \"'bytefreq.1'\" \(1607 characters\)
  1257. sed "s/^X//" >'bytefreq.1' <<'END_OF_FILE'
  1258. X.\" $Header: bytefreq.1,v 1.1 89/08/09 16:22:25 howard Exp $
  1259. X.TH BYTEFREQ 1 "$Revision: 1.1 $"
  1260. X.SH NAME
  1261. Xbytefreq \- frequency-count the bytes in a list of files
  1262. X.SH SYNOPSIS
  1263. X.B bytefreq
  1264. X.RB [ " \-b " ] 
  1265. X.RB [ " \-d " ] 
  1266. X<
  1267. X.I filenames
  1268. X.SH COPYRIGHT
  1269. XCopyright \(co 1989 Howard Lee Gayle
  1270. X.SH DESCRIPTION
  1271. X.I Bytefreq
  1272. Xreads from standard input a list of file names, one per line.
  1273. XIt generates a frequency table of the bytes in the files.
  1274. XThe
  1275. X.B \-b
  1276. Xoption outputs the table in byte order.
  1277. XThe
  1278. X.B \-d
  1279. Xoption outputs the table in descending frequency order.
  1280. XBoth options may be used.
  1281. X.SH EXAMPLE
  1282. XGenerate a frequency table, in frequency order, of the bytes in
  1283. Xall comp news articles:
  1284. X.nf
  1285. X   % find /usr/spool/news/comp \-type f \-name '[0\-9]*' \-print | bytefreq \-d
  1286. X.fi
  1287. X.SH "SEE ALSO"
  1288. X.IR 78 (1).
  1289. X.SH LICENSE
  1290. XThis program is free software; you can redistribute it and/or modify
  1291. Xit under the terms of the GNU General Public License version 1,
  1292. Xas published by the Free Software Foundation.
  1293. X.PP
  1294. XThis program is distributed in the hope that it will be useful,
  1295. Xbut WITHOUT ANY WARRANTY; without even the implied warranty of
  1296. XMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1297. XGNU General Public License for more details.
  1298. X.PP
  1299. XYou should have received a copy of the GNU General Public License
  1300. Xalong with this program; if not, write to the Free Software
  1301. XFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1302. X.SH AUTHOR
  1303. XHoward Gayle,
  1304. XTN/ETX/T/BG,
  1305. XEricsson Telecom AB,
  1306. XS-126 25 Stockholm,
  1307. XSweden,
  1308. Xhoward@ericsson.se,
  1309. Xuunet!ericsson.se!howard,
  1310. XPhone: +46 8 719 5565,
  1311. XFAX: +46 8 719 9598,
  1312. XTelex: 14910 ERIC S
  1313. END_OF_FILE
  1314. if test 1607 -ne `wc -c <'bytefreq.1'`; then
  1315.     echo shar: \"'bytefreq.1'\" unpacked with wrong size!
  1316. fi
  1317. # end of 'bytefreq.1'
  1318. fi
  1319. echo shar: End of archive 3 \(of 14\).
  1320. cp /dev/null ark3isdone
  1321. MISSING=""
  1322. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ; do
  1323.     if test ! -f ark${I}isdone ; then
  1324.     MISSING="${MISSING} ${I}"
  1325.     fi
  1326. done
  1327. if test "${MISSING}" = "" ; then
  1328.     echo You have unpacked all 14 archives.
  1329.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1330. else
  1331.     echo You still need to unpack the following archives:
  1332.     echo "        " ${MISSING}
  1333. fi
  1334. ##  End of shell archive.
  1335. exit 0
  1336.  
  1337.